<?php
$d = new pdo('mysql:host=localhost;port=3306;dbname=zgdb;charset=utf8', 'root', '', []);
$st = $d->prepare('show databases');
$st->execute();
$rs = $st->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($rs);